package cn.kgc.controller;

import cn.kgc.dao.GoodsRepository;
import cn.kgc.entity.Goods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Rock
 * @create 2020-06-17 15:25
 */
@RestController
public class GoodsController {
    @Autowired
    private GoodsRepository goodsRepository;

    @RequestMapping("/goods")
    public List<Goods> getAll(){
        //jpa自己的查询所有findAll()
        //return goodsRepository.findAll();

        //用户自定义查询说有信息getAll()
        return goodsRepository.getAll();
    }
}
